package com.bilibili.www;

/*public class TestTwo {
    int val = 10;//没有加修饰限定符，默认是包访问权限
}*/

class Student {
    //实例成员变量
    private String name;
    private String sex;
    private int age;
    private double score;
    //public String name;
    public static String classRoom = "都在教室里面";

    public Student() {
        System.out.println("Student::不带参数的构造方法！");
    }

    //实例代码块
    {
        System.out.println("构造代码块！/ 实例代码块！");
    }
    {
        this.name = "张三";
        this.age = 12;
        this.sex = "man";
        System.out.println("构造代码块！/ 实例代码块！");
    }

    static {

        System.out.println("这是静态代码块");
    }
    static
    {
        classRoom = "天人城大学";
        System.out.println("这是静态代码块");
    }


    public void show() {
        System.out.println("name: " + this.name + " age: " + this.age + " sex: " + this.sex);
    }

    public static void func() {
        /*this();
        this.name = 10;*/
        classRoom = "天人城教室";
        System.out.println("静态的方法！");
        System.out.println(classRoom);
    }
}

public class TestTwo {
    public static void main(String[] args) {
        //通过类名直接访问 静态成员方法
        //
        Student.func();
    }



    /*public static void main1(String[] args) {
        Student stu = new Student();
        stu.show();
        //通过类名直接访问 静态成员变量
        System.out.println(Student.classRoom);
        //通过类名直接访问 静态成员方法
        Student.func();
        System.out.println("====================================");

        Student stu2 = new Student();
    }*/
}



/*public class Student {
    private String name;
    private String gender;
    private int age;
    private double score;
    private static String classRoom;

    //实例代码块
    {
        this.name = "bit";
        this.age = 12;
    }
}*/
